import React, { useState } from 'react';

import Child from './Child';

const App = () => {
  const [title, setTitle] = useState('hello world');
  const [name, setName] = useState('zhang san');
  return (
    <div>
      <h1>{title}</h1>
      <h2>{name}</h2>
      <button onClick={() => setTitle('hello' + Math.random())}>
        change title
      </button>
      <button onClick={() => setName('wang wu')}>change name</button>
      <Child name={name} />
    </div>
  );
};

export default App;
